:root {
  --ls-tag-text-opacity: 0.8;
  --ls-tag-text-hover-opacity: 1;
  --ls-page-text-size: 1em;
  --ls-page-title-size: 36px;
  --ls-main-content-max-width: 810px;
  --ls-main-content-max-width-wide: 1280px;
  --ls-font-family: Inter;
  --ls-scrollbar-width: 6px;
  --ls-border-radius-low: 4px;
  --ls-border-radius-medium: 8px;
  --ls-headbar-height: 3rem;
  --ls-headbar-inner-top-padding: 0px;
  --ls-left-sidebar-width: 246px;
  --ls-left-sidebar-sm-width: 74vw;
  --ls-left-sidebar-nav-btn-size: 38px;
  --ls-native-kb-height: 0px;
  --ls-error-color: var(--color-red-500);
  --ls-warning-color: var(--color-orange-500);
  --ls-success-color: var(--color-green-500);
  --ls-highlight-color-default: var(--ls-secondary-background-color);
}

@media (prefers-color-scheme: dark) {
  html {
    background-color: #002b36;
  }

  html[data-theme='light'] {
    background-color: transparent;
  }
}

@supports (font-variation-settings: normal) {
  html {
    font-family: 'Inter var', sans-serif;
  }
}

.dark-theme,
html[data-theme='dark'] {
  --ls-primary-background-color: #002b36;
  --ls-secondary-background-color: #023643;
  --ls-tertiary-background-color: #08404f;
  --ls-quaternary-background-color: #094b5a;
  --ls-table-tr-even-background-color: #03333f;
  --ls-active-primary-color: #8ec2c2;
  --ls-active-secondary-color: #d0e8e8;
  --ls-block-properties-background-color: #06323e;
  --ls-page-properties-background-color: #02171d;
  --ls-block-ref-link-text-color: #1a6376;
  --ls-border-color: #0e5263;
  --ls-secondary-border-color: #126277;
  --ls-tertiary-border-color: rgba(0, 2, 0, 0.10);
  --ls-guideline-color: #0b4a5a;
  --ls-menu-hover-color: var(--ls-secondary-background-color);
  --ls-primary-text-color: #a4b5b6;
  --ls-secondary-text-color: #dfdfdf;
  --ls-title-text-color: #93a1a1;
  --ls-link-text-color: rgb(138, 187, 187);
  --ls-link-text-hover-color: var(--ls-active-secondary-color);
  --ls-link-ref-text-color: var(--ls-link-text-color);
  --ls-link-ref-text-hover-color: var(--ls-link-text-hover-color);
  --ls-tag-text-color: var(--ls-link-text-color);
  --ls-tag-text-hover-color: var(--ls-link-text-hover-color);
  --ls-slide-background-color: var(--ls-primary-background-color);
  --ls-block-bullet-border-color: #0f4958;
  --ls-block-bullet-color: #608e91;
  --ls-block-highlight-color: #0a3d4b;
  --ls-selection-background-color: #338fff;
  --ls-selection-text-color: #fff;
  --ls-page-checkbox-color: #6093a0;
  --ls-page-checkbox-border-color: var(--ls-primary-background-color);
  --ls-page-blockquote-color: var(--ls-primary-text-color);
  --ls-page-blockquote-bg-color: var(--ls-secondary-background-color);
  --ls-page-blockquote-border-color: var(--ls-border-color);
  --ls-page-mark-color: #262626;
  --ls-page-mark-bg-color: #fef3ac;
  --ls-page-inline-code-color: var(--ls-primary-text-color);
  --ls-page-inline-code-bg-color: #01222a;
  --ls-scrollbar-foreground-color: #11505f;
  --ls-scrollbar-background-color: rgba(30, 60, 67, 0.1);
  --ls-scrollbar-thumb-hover-color: rgba(255, 255, 255, 0.2);
  --ls-cloze-text-color: #8fbc8f;
  --ls-icon-color: var(--ls-link-text-color);
  --ls-search-icon-color: var(--ls-primary-text-color);
  --ls-search-icon-hover-color: var(--ls-secondary-text-color);
  --ls-a-chosen-bg: var(--ls-quaternary-background-color);
  --ls-pie-bg-color: #01303b;
  --ls-pie-fg-color: #0b5869;
  --ls-highlight-color-gray: var(--color-gray-900);
  --ls-highlight-color-red: var(--color-red-900);
  --ls-highlight-color-yellow: var(--color-yellow-900);
  --ls-highlight-color-green: var(--color-green-900);
  --ls-highlight-color-blue: var(--color-blue-900);
  --ls-highlight-color-purple: var(--color-purple-900);
  --ls-highlight-color-pink: var(--color-pink-900);
  --ls-error-text-color: var(--color-red-400);
  --ls-error-background-color: var(--color-red-900);
  --ls-warning-text-color: var(--color-yellow-400);
  --ls-warning-background-color: var(--color-yellow-900);
  --ls-success-text-color: var(--color-green-100);
  --ls-success-background-color: var(--color-green-900);
  --ls-focus-ring-color: rgba(18, 98, 119, 0.5);
  --ls-header-button-background: #dee4ea;
  --color-level-1: var(--ls-secondary-background-color);
  --color-level-2: var(--ls-tertiary-background-color);
  --color-level-3: var(--ls-quaternary-background-color);
  --color-level-4: #195d6c;
  --color-level-5: #266c7d;
  --color-level-6: #3a7e8e;
}

/* You should always use .light-theme for light mode, the .white-theme is just for backword compatibility.

See: https://github.com/logseq/logseq/pull/4652. */
.white-theme,
.light-theme,
html[data-theme='light'] {
  --ls-primary-background-color: #ffffff;
  --ls-secondary-background-color: #f7f7f7;
  --ls-tertiary-background-color: #eaeaea;
  --ls-quaternary-background-color: #dcdcdc;
  --ls-table-tr-even-background-color: var(--ls-secondary-background-color);
  --ls-active-primary-color: rgb(0, 105, 182);
  --ls-active-secondary-color: #00477c;
  --ls-block-properties-background-color: var(--ls-secondary-background-color);
  --ls-page-properties-background-color: var(--ls-secondary-background-color);
  --ls-block-ref-link-text-color: #d8e1e8;
  --ls-border-color: #ccc;
  --ls-secondary-border-color: #e2e2e2;
  --ls-tertiary-border-color: rgba(200, 200, 200, 0.30);
  --ls-guideline-color: rgba(46, 27, 5, 0.08);
  --ls-menu-hover-color: var(--ls-a-chosen-bg);
  --ls-primary-text-color: #433f38;
  --ls-secondary-text-color: #161e2e;
  --ls-title-text-color: var(--ls-header-button-background);
  --ls-link-text-color: #106ba3;
  --ls-link-text-hover-color: #1a537c;
  --ls-link-ref-text-color: var(--ls-link-text-color);
  --ls-link-ref-text-hover-color: var(--ls-link-text-hover-color);
  --ls-tag-text-color: var(--ls-link-ref-text-color);
  --ls-tag-text-hover-color: var(--ls-link-ref-text-hover-color);
  --ls-slide-background-color: #fff;
  --ls-block-bullet-border-color: #dedede;
  --ls-block-bullet-color: rgba(67, 63, 56, 0.25);
  --ls-block-highlight-color: #c0e6fd;
  --ls-selection-background-color: #e4f2ff;
  --ls-selection-text-color: var(--ls-secondary-text-color);
  --ls-page-checkbox-color: #9dbbd8;
  --ls-page-checkbox-border-color: var(--ls-page-checkbox-color);
  --ls-page-blockquote-color: var(--ls-primary-text-color);
  --ls-page-blockquote-bg-color: #fbfaf8;
  --ls-page-blockquote-border-color: #799bbc;
  --ls-page-mark-color: #262626;
  --ls-page-mark-bg-color: #fef3ac;
  --ls-page-inline-code-bg-color: var(--ls-secondary-background-color);
  --ls-page-inline-code-color: var(--ls-primary-text-color);
  --ls-scrollbar-foreground-color: rgba(0, 0, 0, 0.1);
  --ls-scrollbar-background-color: rgba(0, 0, 0, 0.05);
  --ls-scrollbar-thumb-hover-color: rgba(0, 0, 0, 0.2);
  --ls-cloze-text-color: #0000cd;
  --ls-icon-color: #646464;
  --ls-search-icon-color: var(--ls-primary-text-color);
  --ls-search-icon-hover-color: var(--ls-secondary-text-color);
  --ls-a-chosen-bg: var(--ls-quaternary-background-color);
  --ls-pie-bg-color: #e1e1e1;
  --ls-pie-fg-color: #0a4a5d;
  --ls-highlight-color-gray: var(--color-gray-100);
  --ls-highlight-color-red: var(--color-red-100);
  --ls-highlight-color-yellow: var(--color-yellow-100);
  --ls-highlight-color-green: var(--color-green-100);
  --ls-highlight-color-blue: var(--color-blue-100);
  --ls-highlight-color-purple: var(--color-purple-100);
  --ls-highlight-color-pink: var(--color-pink-100);
  --ls-error-text-color: var(--color-red-600);
  --ls-error-background-color: var(--color-red-100);
  --ls-warning-text-color: var(--color-yellow-700);
  --ls-warning-background-color: var(--color-yellow-100);
  --ls-success-text-color: var(--color-green-800);
  --ls-success-background-color: var(--color-green-100);
  --ls-focus-ring-color: rgba(66, 133, 244, 0.5);
  --ls-header-button-background: rgba(15, 20, 25, 1);
  --color-level-1: var(--ls-secondary-background-color);
  --color-level-2: var(--ls-tertiary-background-color);
  --color-level-3: var(--ls-quaternary-background-color);
  --color-level-4: #d0e6fa;
  --color-level-5: #bbdaf6;
  --color-level-6: #a7cef1;
}

html:not(.is-native-android) {
  font-family: var(--ls-font-family), sans-serif, system-ui,
  -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue',
  Arial, 'Noto Sans', serif, Apple Color Emoji, Segoe UI Emoji,
  Segoe UI Symbol !important;
}

/* region Reset top elements */
html {
  /* FIXME: rewrite revealjs.css ? */
  height: unset !important;
}

body {
  color: var(--ls-primary-text-color);
  line-height: 1.5;
  background-color: transparent;
  min-height: 100%;
  word-break: break-word; /* compatible for overflow-wrap: anywhere */
}

svg {
  pointer-events: none;
}

textarea {
  overflow: hidden;
  padding: 8px;
  border: 1px solid rgba(39, 41, 43, 0.15);
  border-radius: var(--ls-border-radius-low);
  font-size: 1em;
  line-height: 1.5;
  width: 100%;
  resize: none;
  outline: none;
  font-weight: inherit;
  letter-spacing: inherit;
  text-size-adjust: 100%;
  background: var(--ls-primary-background-color);
}

.dark-theme textarea {
  background: var(--ls-tertiary-background-color);
}

ul {
  list-style: circle;
  margin-left: 1.2em;
}

ol {
  list-style: decimal;
  margin-left: 1.2em;
}

p {
  line-height: 1.5;
  margin: 0.5rem 0;
  color: var(--ls-primary-text-color);
}

li {
  margin: 0.25rem 0;
}

li:first-child {
  margin-top: 0;
}

pre {
  background: var(--ls-secondary-background-color, #f6f8fa);
  margin: 1rem 0;
  line-height: 1.45em;
  overflow: auto;
}

a {
  cursor: pointer;
  color: var(--ls-link-text-color, #045591);
  text-decoration: none;
}

a:hover {
  color: var(--ls-link-text-hover-color, #000);
}

code {
  font-size: 85%;
}

pre.code {
  background: #282a36;
  background: var(--ls-secondary-background-color);
  color: var(--ls-primary-text-color, #f8f8f2);
}

dl {
  margin: 1rem 0;
}

dt {
  margin-bottom: 0.25rem;
  font-weight: bold;
}

blockquote {
  display: block;
  text-indent: 0;
  padding: 8px 20px;
  border-left: 4px solid;
  border-left-color: var(--ls-page-blockquote-border-color, #d3d3d3);
  background-color: var(--ls-page-blockquote-bg-color, #f7f7f7);
  margin: 1rem 0;
  color: var(--ls-page-blockquote-color, #24292e);
  font-size: 1rem;
}

input[type=text], input[type=password] {
  color: var(--ls-primary-text-color);
  background: transparent;
  font-size: inherit;
}

summary {
  outline: none;
}

iframe {
  width: 100%;
  margin: 1rem 0;
}

img,
video {
  margin-left: auto;
  margin-right: auto;
}

::selection {
  background: var(--ls-selection-background-color);
  color: var(--ls-primary-text-color);
}

::-moz-selection {
  background: var(--ls-selection-background-color);
  color: var(--ls-primary-text-color);
}

/* endregion */

/** region App utilities **/
.ls-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

li p:first-child,
.block-body p:first-child {
  margin-top: 0;
}

li p:last-child,
.block-body p:last-child, .block-body ul:last-child, .block-body ol:last-child, .block-body dl:last-child {
  margin-bottom: 0;
}

.bg-base-2 {
  background-color: var(--ls-secondary-background-color, #f0f8ff);
}

.bg-base-3 {
  background-color: var(--ls-primary-background-color, #fff);
}

.bg-base-4 {
  background-color: var(--ls-tertiary-background-color);
}


.pre-white-space {
  white-space: pre;
}

.pre-wrap-white-space {
  white-space: pre-wrap;
}

.pre-line-white-space {
  white-space: pre-line;
}

.cursor-pointer,
.cursor {
  cursor: pointer;
}

.external-link {
  text-decoration: none;
  border-bottom: 1px solid;
}

.noscroll {
  position: fixed;
  overflow-y: scroll;
}

.canceled,
.cancelled,
.done {
  text-decoration: line-through;
  opacity: 0.6;
}

.opacity-30 {
  opacity: 0.3;
}

.opacity-70 {
  opacity: 0.7;
}

.opacity-80 {
  opacity: 0.8;
}

.done > input {
  opacity: 1;
}

.page-drop-options {
  width: 18em;
}

.fixed-width {
  max-width: calc(var(--ls-main-content-max-width) - 30px);
}

.center,
.foldable-title {
  margin: 0 auto;
}

.translate-x-5 {
  --transform-translate-x: 1.25rem;
}

.done,
.canceled,
.cancelled {
  opacity: 0.7;
}

.tip-shadow {
  -webkit-filter: drop-shadow(1px 1px 2px rgba(155, 155, 0, 0.8));
  filter: drop-shadow(1px 1px 2px rgba(155, 155, 0, 0.8));
}

.admonition-icon {
  border-right: 1px solid;
  border-right-color: var(--ls-border-color, #ccc);
}

i.ti {
  /*
  compensates the wrong top spacing in the iconfont.
  See https://github.com/tabler/tabler-icons/issues/118/
  */
  transform: translateY(-1px);
}

.dnd-separator {
  border-bottom: 3px solid #ccc;
}

.aspect-ratio-square {
  padding-top: 100%;
}

.aspect-ratio-16\/9 {
  padding-top: 56.25%;
}

.aspect-ratio-4\/3 {
  padding-top: 75%;
}

.aspect-ratio-21\/9 {
  padding-top: 42.86%;
}

.admonitionblock {
  margin: 2rem 0;
}

.abstract {
  margin: 2rem 0;
  width: 80%;
  font-style: italic;
}

.abstract p:last-of-type::before {
  content: '    ';
  white-space: pre;
}

.dropdown-overflow-auto {
  max-height: 400px;
  overflow-y: auto;
}

.heading-bg {
  border-radius: 50%;
  width: 18px;
  height: 18px;

  &.remove {
    @apply border flex items-center justify-center;

    border-color: var(--border-color);
  }
}

.to-heading-button {
  @apply px-1 text-lg !important;
}

/** endregion **/

/* region FIXME: override elements (?) */
h1.title {
  margin-bottom: 1.5rem;
  color: var(--ls-title-text-color, #222);
  font-size: var(--ls-page-title-size, 36px);
  font-weight: 500;
}

.title .page-icon {
  margin-right: 12px;
}

.block-highlight,
.content .selected {
  transition: background-color 0.2s cubic-bezier(0, 1, 0, 1);
  background-color: var(--ls-block-highlight-color);
  padding: -1px;
}

span.timestamp {
  margin: 0 0.25rem;
}

span.priority {
  color: #6b7280;
}

.form-checkbox:not(:checked):focus {
  box-shadow: none;
}

.form-checkbox:checked:focus {
  box-shadow: none;
}

a.nav-item:hover,
a.star-page:hover {
  background-color: #00242d;
}

button.menu {
  border-right: 1px solid;
  border-right-color: var(--ls-secondary-background-color, #f0f8ff);
  color: var(--ls-link-text-color, #24292e);
}

.menu-link:hover,
button.pull:hover,
button.menu:focus {
  background-color: var(--ls-menu-hover-color, #f4f5f7);
}

.menu-links-wrapper, .menu-links-outer {
  @apply py-2 rounded-md shadow-lg overflow-y-auto;

  max-height: calc(100vh - 100px) !important;
  background-color: var(--ls-primary-background-color, #fff);
  min-width: 12rem;
}

.menu-backdrop {
  @apply w-full h-full fixed top-0 left-0;

  z-index: var(--ls-z-index-level-1);
}

.menu-link {
  background-color: var(--ls-primary-background-color, #fff);
  color: var(--ls-primary-text-color);
  user-select: none;
}

.menu-separator {
  @apply my-1;

  opacity: .5;
  border-top-width: 1px;
  border-color: var(--ls-border-color, #ccc);
}

a.login {
  color: var(--ls-link-text-color, #444);
}

a.login:hover {
  color: var(--ls-link-text-hover-color, #000);
}

a.tooltip-priority {
  display: contents;
  position: absolute;
  left: 0;
}

a.tooltip-priority::after {
  content: attr(priority);
  margin-right: 10px;
}

a.chosen {
  background: var(--ls-a-chosen-bg);
}

a.warning,
span.warning, div.warning:not(.admonitionblock), p.warning {
  background: var(--ls-warning-background-color);
  padding: 0.1em 0.4em;
  border-radius: var(--ls-border-radius-low);
  color: var(--ls-warning-text-color);
}

.text-warning {
  color: var(--ls-warning-text-color);
}

.bg-warning {
  background: var(--ls-warning-background-color);
}

a.error,
span.error {
    background: var(--ls-error-background-color);
    padding: 0.1em 0.4em;
    border-radius: var(--ls-border-radius-low);
    color: var(--ls-error-text-color);
}

.text-error {
  color: var(--ls-error-text-color);
}

.bg-error {
  background: var(--ls-error-background-color);
}

.text-success {
  color: var(--ls-success-text-color);
}

.bg-success {
  background: var(--ls-success-background-color);
}


img.small {
  display: inline;
  width: 20px;
  height: 20px;
  margin-top: 0;
  margin-bottom: 0;
}

a.tag {
  font-size: 0.9em;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  cursor: pointer;
  color: var(--ls-tag-text-color, #045591);
  opacity: var(--ls-tag-text-opacity, 0.8);
}

a.tag:hover {
  opacity: var(--ls-tag-text-hover-opacity, 1);
  color: var(--ls-tag-text-hover-color, #045591);
}

svg.note {
  color: var(--ls-primary-text-color, #19407c);
}

svg.tip {
  color: var(--ls-active-primary-color);
}

/* endregion */

/* region FIXME: CodeMirror override (?) */
.CodeMirror pre.CodeMirror-line,
.CodeMirror-scroll,
.CodeMirror-sizer,
.CodeMirror-gutter,
.CodeMirror-gutters,
.CodeMirror-linenumber {
  font-size: 14px;
}

/* endregion */

hr {
  margin: 2rem 0;
  border-color: var(--ls-border-color, #ccc);
}

.resize {
  resize: both;
  overflow: hidden;
  max-width: -webkit-fill-available;
}

/* ideas from https://github.com/PiotrSss/logseq-bujo-theme/blob/main/main.css */

/***************************************************************
***************************** TOP ******************************
***************************************************************/

.cp__header-logo,
.fade-link {
  opacity: 0.8;
  transition: 0.3s;
  color: var(--ls-primary-text-color);
}

a.fade-link:hover {
  opacity: 1;
}

/* import (arrows) icon */

#head .refresh svg {
  height: 20px;
}

.svg-small svg {
    transform: scale(0.6);
    display: inline;
}

/* < > buttons */

a.navigation {
  border-radius: 3px;
  transition: 0.3s;
}

/* text mark/highlight */

mark {
  background: var(--ls-page-mark-bg-color);
  color: var(--ls-page-mark-color);
  padding: 2px 4px;
  border-radius: 3px;
}

/* page reference */

.page-reference {
  border-radius: 3px;
  padding: 2px 0px;
  transition: 0.3s;
}

.page-reference .bracket {
  opacity: 0.3;
}

/* block references */
.block-ref .block-ref {
  padding: 6px 5px;
  border: none;
}

/* inline code */
:not(pre) > code {
  border-radius: 3px;
  font-size: 0.9em;
  font-style: normal;
  font-family: MonoLisa, 'Fira Code', Monaco, Menlo, Consolas, 'COURIER NEW',
    monospace;
  letter-spacing: 0;
  background-color: var(--ls-page-inline-code-bg-color, #eee);
  color: var(--ls-page-inline-code-color);
  word-spacing: -0.15em;
  text-rendering: optimizeSpeed;
}

:not(pre):not(mark) > code {
  line-height: 1.45;
  padding: 3px 5px !important;
  border-radius: var(--ls-border-radius-low);
  -webkit-border-radius: var(--ls-border-radius-low);
}

mark > code {
  padding: 0;
  line-height: inherit !important;
  background: #fef3ac !important;
  color: #262626 !important;
}

b > code {
  font-weight: bold !important;
}

i > code {
  font-style: italic !important;
}

a {
  transition: 0.3s;
}

a.tooltip-priority {
  transition: none;
}

.page-reference:hover {
  background: var(--ls-secondary-background-color);
}

.references-blocks .page-reference:hover {
  background: var(--ls-tertiary-background-color);
}

#head .fade-link {
  font-weight: 600;
  font-size: 13px;
}

/* excalidraw */
.Island > div > div > div {
  width: 44px;
}

.excalidraw hr {
  margin: 0;
}

.text-link {
  color: var(--ls-primary-text-color);
}

.katex * {
  border-color: var(--ls-primary-text-color);
}

#help-latex .katex-html {
  text-align: right;
}

a.page-op svg {
  transform: scale(0.9);
}

.search-more {
    background: var(--ls-a-chosen-bg);
}

.keyboard-shortcut > code {
  margin: 2px;
  background-color: var(--ls-quaternary-background-color);
  padding: 2px 4px !important;
  border-radius: 6px;
  color: var(--ls-secondary-text-color);
}

html[data-theme='light'] .keyboard-shortcut > code {
  box-shadow: inset 0 -1px 0 #433f3855, 0 0 1px 1px #433f3822;
}

html[data-theme='dark'] .keyboard-shortcut > code {
  box-shadow: inset 0 -1px 0 var(--ls-primary-background-color), 0 0 1px 1px rgba(255, 255, 255,.2);
}

.ui__modal-panel {
  border-radius: 8px;
}

.overflow-y-scroll {
    overflow-y: scroll;
}

.text-ellipsis-wrapper {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lazy-visibility {
    min-width: 1px;
    min-height: 1px;
}

.katex .tag {
    overflow-x: clip;
}

html.is-mobile {
  h1.title {
    margin-bottom: 10px;
  }

  #journals .journal-item:first-child {
    margin-top: 5px;
  }
}

@layer base {
    .ls-grid-cols {
        @apply grid grid-flow-col auto-cols-max;
        place-items: center;
    }

  /* fixes an html2canvas issue */
  img {
    @apply inline-block;
  }
}
